package com.dianzhihan.cashier.model.order;

import com.dianzhihan.cashier.model.product.Product;
import lombok.Data;

/**
 * @author Dianzhi Han
 * @version 1.0
 * @description: 订单-商品项
 * @date 2023/2/5 13:30
 */
@Data
public class OrderItem {
    private Integer id;
    private int orderId;
    private int productId;
    private String productName;
    private String productIntroduce;
    private int productNumber;
    private String productUnit;
    private int productPrice;
    private int productDiscount;

    public OrderItem(){};

    public OrderItem(Order order, Product product, int number) {
        this.orderId = order.getOrderId();
        this.productId = product.getProductId();
        this.productName = product.getProductname();
        this.productIntroduce = product.getDescription();
        this.productNumber = number;
        this.productUnit = product.getUnit();
        this.productPrice = product.getPrice();
        this.productDiscount = product.getDiscount();
    }
}
